import os

# 复杂列表创建
if __name__ == '__main__':
    # 1*1, 2*2, 3*3....
    sampleList = [x * x for x in range(1, 11)]
    print(sampleList)

    # [1,2] * [5, 6, 7] 双层嵌套循环
    sampleList = [x * y for x in range(1, 3) for y in range(5, 8)]
    print(sampleList)

    # 过滤条件
    print([x for x in sampleList if x % 2 == 0])

    # 条件匹配、转换
    print([x if x % 2 else -x for x in sampleList])

    # 当前目录下的文件
    print([d for d in os.listdir('.')])
